<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:composite="http://java.sun.com/jsf/composite">
    
    <!-- INTERFACE -->
    <composite:interface>
        <composite:attribute name="username" required="false"/>
        <composite:attribute name="password" required="false"/>
        <composite:attribute name="loginaction" required="true" method-signature="java.lang.String login()"/>
    </composite:interface>
    
    <!-- IMPLEMENTATION -->
    
    <composite:implementation>
        <h:form>
            <div class="formblock">
                <h:outputLabel value="#{msg.username}" for="username" />
                <h:inputText id="username" value="#{cc.attrs.username}">
                    <f:validateRegex pattern="[A-Za-z]+"/>
                </h:inputText>
                <h:messages styleClass="error" for="username" showSummary="false" showDetail="true" />
                <h:outputLabel value="#{msg.password}" for="password" />
                <h:inputSecret id="password" value="#{cc.attrs.password}">
                    <f:validateLength minimum="3"/>
                    <f:validateRegex pattern="[A-Za-z0-9]*([A-Za-z][0-9]|[0-9][A-Za-z])[A-Za-z0-9]*" />
                </h:inputSecret>
                <h:messages styleClass="error" for="password" showSummary="false" showDetail="true"/>
            </div>
            <div id="buttons" class="clearer">
                <h:commandButton id="login" value="#{msg.login}" action="#{cc.attrs.loginaction}" />
            </div>
        </h:form>
    </composite:implementation>
</html>
